//Entity.h
#ifndef _ENTITY_H_
    #define _ENTITY_H_

#include <vector>

#include "../Drawing/Area.h"
#include "../Drawing/Animation.h"
#include "../Drawing/Camera.h"
#include "../FPS.h"
#include "../Drawing/Surface.h"


//Entity is a class that deals with all objects on the map
class Entity {
    public:

//Creates a vector of Entity* that holds all
//of the maps Entity objects
        static std::vector<Entity*>    EntityList;

//floats X and Y are the x,y coordinates of an Entity
        float           X;
        float           Y;

//ints Width and Height are the width and height of an Entity
        int             Width;
        int             Height;

//bools MoveLeft, MoveRight, MoveDown, and MoveUp are
//used to determine where the Entity should move
        bool        MoveLeft;
        bool        MoveRight;
        bool        MoveDown;
        bool        MoveUp;

//Sets the Type of the Entity
        int        Type;

//Controls what Flags are given to the Entity
        int        Flags;

//No argument constructor
        Entity();

//Virtual class destructor
        virtual ~Entity();

//virtual function used to load the Entity from a file,
//assign the Entity a width, height, and the max number of frames per second
        virtual bool OnLoad(char* File, int Width, int Height, int MaxFrames);

//Controls the Entity's movement
        virtual void OnLoop();

//Loads the surface on which the Entity is rendered
        virtual void OnRender(SDL_Surface* Surf_Display);

//Cleans the surface of Entities
        virtual void OnCleanup();

//Animates an Entities movement
        virtual void OnAnimate();

//Determines if two Entities have collided
        virtual bool OnCollision(Entity* Entity);

//Sets the new x,y coordinates for the Entity based on
//the resulting move to floats MoveX and MoveY
        void    OnMove(float MoveX, float MoveY);

//Stops the Entity
        void     StopMove();

//If the Entity collides with the x,y coordinates of another Entity
//oX and oY are the locations of the other Entity
//oW and oH are the width and height of the other Entity
        bool    Collides(int oX, int oY, int oW, int oH);


    protected:

//Animation variable to control the animation
        Animation      Anim_Control;

//A pointer to create the surface on which the Enitity image is loaded
        SDL_Surface*    Surf_Entity;

//Floats that set the speed in the X and Y directions that the Entity can move
        float        SpeedX;
        float        SpeedY;

//Ints that are the current Collumn/Row of the Entity's image
        int             CurrentFrameCol;
        int             CurrentFrameRow;


//The Collumns x,y coordinates and the collumns width and height
        int        Col_X;
        int        Col_Y;
        int        Col_Width;
        int        Col_Height;



    private:
        bool     PosValid(int NewX, int NewY);

        bool     PosValidTile(Tile* Tile);

        bool     PosValidEntity(Entity* Entity, int NewX, int NewY);
};



//EntityCol is a class that keeps tracnk of all the Entities
class EntityCol {
    public:

//A EntityCol vector that holds the collumns of the Enities
        static std::vector<EntityCol>    EntityColList;

//Creates two Entities
        Entity* Entity1;
        Entity* Entity2;

//No argument constructor
        EntityCol();
};

enum {
    ENTITY_TYPE_GENERIC = 0,

    ENTITY_TYPE_PLAYER,

    ENTITY_FLAG_MAPONLY    = 0x00000004
};



#endif
